class Solution {
    public boolean isValidSudoku(char[][] board) {
        int[][] row = new int[9][9];
        int[][] col = new int[9][9];
        int[][][] threeSun = new int[3][3][9];

        for(int i = 0; i < 9; i++) {
            for(int j = 0; j < 9; j++) {
                if(board[i][j] != '.') {
                    int index = board[i][j] - '1';
                    // System.out.print(index + " ");
                    row[i][index]++;    //操作第一行
                    col[j][index]++;    //操作第一列
                    threeSun[i/3][j/3][index]++;    //操作降阶的矩阵

                    if(row[i][index] > 1 || col[j][index] > 1 || threeSun[i/3][j/3][index] > 1) {
                        return false;
                    }
                }
            }

            // System.out.println();
        }

        return true;
    }
}